#ifndef BROWSERVIEW_H
#define BROWSERVIEW_H

#include <QWidget>
#include <QLineEdit>
#include <QWebEnginePage>
#include <QMenu>
#include <QMessageBox>
#include <QMouseEvent>

#include "register.h"
#include "star.h"
#include "star_net.h"
#include "tabwidget.h"
#include "userconf.h"
#include "historyrecord.h"
#include "tools/uawidget.h"
#include "tools/requestinterceptor.h"

namespace Ui {
class browserview;
}

class TabWidget;
class WebView;

class downloadManagerWidget;
class popwidget;
class settingwidget;


class browserview : public QWidget
{
    Q_OBJECT

public:
    explicit browserview(QWidget *parent = nullptr);
    ~browserview();
    TabWidget *tabWidget() const;
    WebView *currentTab() const;
    //收藏夹相关
    void initMenu();
    void loaddata();
//    static void closewin();
//    static browserview * bptr;
private slots:

    // 功能弹窗相关
    void changepopupwindowVisibility();
    void changepopupwindow2Visibility();
    //设置相关
    void changesettingwidgetVisibility();
    void changeUA(int UA);
    void changeADBlock(bool on);

    // 下载相关
    void changeDownloadManagerWidgetVisibility();

   // void on_btn_user_clicked();
    //收藏夹相关
    void on_favorite_clicked();
    void moreStar();
    void openStar_net();
    void url_for_open(int i);
    void updateData(QString url);

    //历史记录相关
    void on_history_clicked();
    void updateDataHR(QString url);



private:
    Ui::browserview *ui;
    QLineEdit *urlEdit;
    QAction *m_favAction;

    //功能弹窗相关
    popwidget *popupwindow;
    popwidget *popupwindow2;
    void setuppopwidget();
    void setuppopwidget2();
    //设置相关
    settingwidget *settingWidget;
    void setupsettingwidget();
    RequestInterceptor *ADinterceptor;

    //用户相关
    Login * setloginWidget;
    UserConf *setconfWidget;
    void setuploginwidget();
    void changeloginwidgetVisibility();
    //下载相关
    downloadManagerWidget *downloadManager;
    void setupDownload();
    //收藏夹相关
    Star_net *star_net;
    star st;
    TabWidget tabwidget;
    QMenu *m_MoreMenu;
    QMenu *childMenu;
    QMenu *MainMenu;
    QAction *m_morestar;
    QAction *m_liststar[5];

};

#endif // BROWSERVIEW_H
